/**
 * Created with IntelliJ IDEA
 * Description 泛型
 * User: 王杰
 * Date: 2025-05-15
 * Time: 14:55
 */
public class Test {
    public static void main(String[] args) {
        Object o1 =true ? new Integer(1):new Double(2.0);
        System.out.println(o1);//1.0
    }

    public static void main5(String[] args) {
        printMsg("111",222,"aaaa","2323.4",55.55);

    }

    public static <T> void printMsg( T... args){
        for(T t : args){
            System.out.println("泛型测试t is " + t);
        }
    }
    void func1(int N) {
        int count = 0;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                count++;
            }
        }

        for (int k = 0; k < 2*N; k++) {
            count++;
        }

        int M = 10;
        while (M-- > 0) {
            count++;
        }

        System.out.println(count);
    }
    public static void main4(String[] args) {
        int a = 10;

        Integer b = a;
        Integer c = (Integer) a;

        int j = b;
        int k = (int)b;
    }

    // 面试题
    public static void main3(String[] args) {
        Integer a = 10;
        Integer b = 10;
        System.out.println(a == b);

        Integer c = 200;
        Integer d = 200;
        System.out.println(c == d);
    }

    // 拆箱
    public static void main2(String[] args) {
        Integer a = 10;
        int b = a;
        int c = a.intValue();
        double d = a.doubleValue();
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);
    }

    // 装箱
    public static void main1(String[] args) {
        int a = 10;
        Integer i = Integer.valueOf(a);// 显示装箱
        Integer i2 = 10;

        Double d = Double.valueOf(a);
        System.out.println(i);
        System.out.println(i2);
    }
}
